﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using System.Web.Routing;


namespace Photocopy
{
    public class Global : System.Web.HttpApplication
    {
        //void RegisterRoutes(RouteCollection routes)
        //{
        //    routes.MapPageRoute("products", "Admin/Products", "~/ProductList.aspx");
        //}
        protected void Application_Start(object sender, EventArgs e)
        {
            //RegisterRoutes(RouteTable.Routes);
            Application["SoLuotTruyCap"] = 0;
            Application["SoNguoiOnl"] = 0;
        }

        protected void Session_Start(object sender, EventArgs e)
        {
            Application.Lock();
            Application["SoLuotTruyCap"] = Convert.ToInt32(Application["SoLuotTruyCap"].ToString()) + 1;
            Application["SoNguoiOnl"] = Convert.ToInt32(Application["SoNguoiOnl"].ToString()) + 1;
            Application.UnLock();
        }

        protected void Application_BeginRequest(object sender, EventArgs e)
        {

        }

        protected void Application_AuthenticateRequest(object sender, EventArgs e)
        {

        }

        protected void Application_Error(object sender, EventArgs e)
        {

        }

        protected void Session_End(object sender, EventArgs e)
        {
            Application.Lock();            
            Application["SoNguoiOnl"] = Convert.ToInt32(Application["SoNguoiOnl"].ToString()) - 1;
            Application.UnLock();
        }

        protected void Application_End(object sender, EventArgs e)
        {

        }
    }
}